package com.ciwong.epaper.widget.evaluate;

import android.content.Context;
import android.util.AttributeSet;
import android.widget.FrameLayout;

import com.ciwong.epaper.widget.PlayStateView;

/**
 * Created by lzr on 2017/4/18.
 */
public class BaseRepFrameLayout extends FrameLayout {
    private PlayStateView stateImg;

    private long userId;

    public BaseRepFrameLayout(Context context) {
        super(context);
    }

    public BaseRepFrameLayout(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    public BaseRepFrameLayout(Context context, AttributeSet attrs, int defStyle) {
        super(context, attrs, defStyle);
    }

    public void initData(PlayStateView stateImg, long userId) {
        this.stateImg = stateImg;
        this.userId = userId;
    }


    public void closeStateIm() {
        /*if (stateImg != null)
            stateImg.closeView();*/
    }


    /**
     * 开始录音语句
     */
    public void startRecord(long timeLong) {
        stateImg.setTimeCount(timeLong);
        stateImg.startRecord();
    }

    public void updatePlayProgress(long total, long progress) {
        stateImg.updatePlayProgress(total, progress);
    }

    /**
     * 获取指定的SpeechTextView
     * <p>
     * 句子
     *
     * @return {@link SpeechTextView}
     */
    public PlayStateView getStateImg() {
        return stateImg;
    }

    /**
     * 开始播放语句
     */
    public void play(long timeLong) {
        stateImg.setTimeCount(timeLong);
        stateImg.startPlay();
    }
}
